public class Test3{
	public static void main(String[] args){
		int count = 0 ;
		for(int i = 2 ; i <= 20000 ; i++){
			int flag = 1 ;
			for(int j = 2 ; j < i ; j++){
				if(i % j == 0){
					flag = 0 ;
				}
			}
			if(flag ==  1){
				count ++ ;
				System.out.print( i + " ") ;
				if(count != 0 && count % 5 == 0)
					System.out.println();		
			}		
		}
	System.out.println();
	System.out.println("1到20000之间的素数有" + count + "个");
	}	
}